#include <Ape/MT/Task.h>

namespace Ape {
	namespace MT {
		Task::Task (const Ape::String taskName) : Thread (taskName) {
			OnStart += Delegate (Task, this, __Run);
		}
		
		Task::~Task() {}
		
		void Task::__Run (EventArgs& ea) {
			OnBeforeRun (ea);
			if (ea.Cancelled() )
				return;
			Run (ea);
			OnAfterRun (ea);
		}
	}
}
